package sc

import java.sql.DriverManager

object DemoJdbc {
  def main(args: Array[String]): Unit = {
    Class.forName("com.mysql.cj.jdbc.Driver")
    val conn = DriverManager.getConnection("jdbc:mysql://192.168.205.129:3306/students?useSSL=false&serverTimezone=UTC&characterEncoding=UTF-8", "root", "123456")
    val ps = conn.prepareStatement("select * from overtime")
    val res = ps.executeQuery()
    while (res.next()) {
      val name = res.getString("employee_name")
      val dept = res.getString("department")
      val hours = res.getString("hours")
      println(name+" "+dept +" "+ hours)
    }
    res.close()
    ps.close()
    conn.close()



  }

}
